<?
define('_VIEW_MODEL_','default');
require_once './init.php';
header("Content-type:text/vnd.wap.wml;charset=utf-8"); 
$id = intval($id);
$no = intval($auid);
$nid = intval($nid);
$friend="";
$state = "";
$novel = $db->GetRow("select * from {$telper}novel where `id` = '$nid' and state=0");
//echo "select * from {$telper}novel where `authid` = '$no'";
$num  = $db->GetRow("select count(id) from {$telper}chapter where novelid = '$nid'");
$cnum = !empty($num)?$num['count(id)']:'0';
//echo "select * from {$telper}chapter where novelid =$nid";
$rs = $db->Execute("select * from {$telper}chapter where novelid =$nid");
$noinfo = $rs->GetArray();
if(empty($noinfo)){
	$noinfo = "false";
}
$tim = time();
$rs = $db->Execute("select `title`,`link` from {$telper}friendlink where state = 0 order by rank desc");
$friendinfo = $rs ->GetArray();
foreach($friendinfo as $k=>$v){
	$friend .="<a href='$v[link]'>$v[title]</a>";
	$k = $k+1;
	if($k%4 ==0 && count($friend)%4 != 0){
		$friend .="<br/>";
	}
	if($k%4 !=0 && count($friendinfo)>$k){
		$friend .=".";
	}
}
//print_R($noinfo);
$smartyObj->assign('friendlink',$friend);
$smartyObj->assign("id",$id);
$smartyObj->assign("auid",$no);
$smartyObj->assign("noid",$nid);
$smartyObj->assign("num",$cnum);
$smartyObj->assign("time",$tim);
$smartyObj->assign("info",$novel);
$smartyObj->assign("noinfo",$noinfo);
$smartyObj->display("noveldetil.tpl");
?>